const fs = require('fs');

fs.writeFile('data.txt', 'Hello, My friends!', (error) => {
  if (error) {
    console.error('写入文件时出错:', error);
  } else {
    console.log('文件写入成功！');
  }
});